package com.sdleyou.treepro.manager.api.prop;

import com.sdleyou.treepro.common.model.dto.PropDTO;
import com.sdleyou.treepro.common.model.utils.ResultVOUtil;
import com.sdleyou.treepro.common.model.vo.ResultVO;
import com.sdleyou.treepro.common.service.PropManager;
import com.sdleyou.treepro.system.version.ApiVersion;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 道具控制器
 *
 * @author gx
 * @version v1.0
 * 2020年2月22日
 */
@RestController
@RequestMapping("/api")
public class ManagerPropController {
    @Autowired
    private PropManager propManager;

    @ApiVersion(1)
    @PostMapping("/{version}/manager/prop")
    public ResultVO createProp(@RequestBody PropDTO propDTO) {
        propManager.createProp(propDTO);
        return ResultVOUtil.success();
    }

    @ApiVersion(1)
    @PutMapping("/{version}/manager/prop/{prop_id}")
    public ResultVO updateProp(@RequestBody PropDTO propDTO,
                               @PathVariable("prop_id") String propId) {
        propManager.updateProp(propDTO, propId);
        return ResultVOUtil.success();
    }

}

